#include<bits/stdc++.h>
using namespace std;
int n,m,k;
int w[200011];
long long Solve()
{
	long long res = 0;
	for(int i = 1;i < n;i++)
		res += w[i];
	long long x = 0;
	for(int i = 1;i < n;i++)
	{
		x -= (w[i + 1] - w[i]);
		if(x < 0)
			res -= x,x = 0;
	}
	return res;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	freopen("guard.in","r",stdin);
	freopen("guard.out","w",stdout);
	cin >> n >> m >> k;
	for(int i = 1;i <= n;i++)
		cin >> w[i];
	long long ans = Solve();
	reverse(w + 1,w + n + 1);
	ans = min(ans,Solve());
	cout << ans;
	return 0;
}
